home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / GRAPH_FO / (GRAPH / GRAPH_HE / GRAPH.H next >
Text File  |  1991-04-03  |  2KB  |  85 lines

  1. /******************************************************************************
  2.     Graph.h
  3.         Graph methods in Object C.
  4.  
  5.     SUPERCLASS = CObject
  6.  
  7.     Copyright ⌐ 1991 Maarten Meijer. All rights reserved.
  8.         CIS 100016,1764; FidoNet 2:512/114
  9. *******************************************************************************/
  10.  
  11. #define    _H_Graph
  12.  
  13. /* includes */
  14. #include <CObject.h>
  15. #include <CPanorama.h>
  16. #include "GrList.h"
  17. #include "GrVertex.h"
  18. #include "GrEdge.h"
  19.  
  20. /* class definition */
  21. struct Graph : CObject {
  22.     CPanorama    *itsPane;        /* the enclosing panorama */
  23.     GrList        *vertexList;
  24.     GrList        *edgeList;
  25.  
  26.     short        _flags;            /* not used at the moment */
  27.                                 /* can be used analogous to ListManager */
  28.     Point        _grid;
  29.  
  30.     void        IGraph(CPanorama *thePane, int flags, Point grid);
  31.  
  32.     /* Freeing methods */
  33.     void        Dispose(void);    /* OVERRIDE */
  34.  
  35.     /* Drawing methods */
  36.     Point        Align(Point pt);        /* align point to grid */
  37.     void        Draw(Rect *area);
  38.  
  39.     /* selection routines */
  40.     void        Deselect(void);
  41.  
  42.     /* Manipulation routines */
  43.     GrVertex *    FindVertex(Point where);
  44.     GrEdge    *    FindEdge(Point where);
  45.  
  46.     /* Creation routines for edges and vertices */
  47.     GrVertex *    NewVertex(void);
  48.     GrEdge *    NewEdge(void);
  49.  
  50.     GrVertex *    AddVertex(Point center, Boolean redraw);
  51.     GrEdge *    AddEdge(GrVertex *from, GrVertex *to, Boolean redraw);
  52.  
  53.     void        RemoveVertex(GrVertex *whichVertex, Boolean redraw);
  54.     void        RemoveEdge(GrEdge *whichEdge, Boolean redraw);
  55.  
  56.     /* Macintosh support routines */
  57.     void        SetVertexCenter(GrVertex *which, Point where, Boolean redraw);
  58.     void        GetGrid(Point *grid);
  59.  
  60.     /* Query methods */
  61.     Boolean        AdjacentTo(GrVertex *v1, GrVertex *v2);
  62.     Boolean        AdjacentFrom(GrVertex *v1, GrVertex *v2);
  63.  
  64.     Boolean        Adjacent(GrVertex *v1, GrVertex *v2);
  65.  
  66.     /* Setting options */
  67.     void        SetOptions(void);
  68.     };
  69.  
  70. /* externs */
  71. extern void Graph_CompileRgn(GrVertex *this, RgnHandle rgn);
  72.  
  73. /* defines */
  74. #define grHAlign        0x0001    /* auto align */
  75. #define grVAlign        0x0002    /* auto align */
  76. #define grDirected        0x0004    /* directed graph */
  77. #define grMulti            0x0008    /* multiple edges between vertices */
  78. #define grSelfRef        0x0010    /* allow edges to self vertex */
  79. #define grDebug            0x0020    /* show rectangles */
  80.  
  81. #define grErrID            131
  82. #define grUnimplErr        1
  83. #define grDigraphErr    2
  84. #define grMultiErr        3
  85. #define grNoSelfErr        4